package com.ruoyi.merchant.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.merchant.domain.Article;
import com.ruoyi.merchant.mapper.ArticleMapper;
import com.ruoyi.merchant.service.IArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * articleService业务层处理
 * 
 * @author juchengxin
 * @date 2024-07-03
 */
@Service
public class ArticleServiceImpl implements IArticleService
{
    @Autowired
    private ArticleMapper articleMapper;

    /**
     * 查询article
     * 
     * @param id article主键
     * @return article
     */
    @Override
    public Article selectArticleById(String id)
    {
        return articleMapper.selectArticleById(id);
    }

    /**
     * 查询article列表
     * 
     * @param article article
     * @return article
     */
    @Override
    public List<Article> selectArticleList(Article article)
    {
        List<Article> articles = articleMapper.selectArticleList(article);
        return articles;
    }

    /**
     * 新增article
     * 
     * @param article article
     * @return 结果
     */
    @Override
    public int insertArticle(Article article)
    {
        article.setCreateTime(DateUtils.getNowDate());
        return articleMapper.insertArticle(article);
    }

    /**
     * 修改article
     * 
     * @param article article
     * @return 结果
     */
    @Override
    public int updateArticle(Article article)
    {
        article.setUpdateTime(DateUtils.getNowDate());
        return articleMapper.updateArticle(article);
    }

    /**
     * 批量删除article
     * 
     * @param ids 需要删除的article主键
     * @return 结果
     */
    @Override
    public int deleteArticleByIds(String[] ids)
    {
        return articleMapper.deleteArticleByIds(ids);
    }

    /**
     * 删除article信息
     * 
     * @param id article主键
     * @return 结果
     */
    @Override
    public int deleteArticleById(String id)
    {
        return articleMapper.deleteArticleById(id);
    }
}
